import { EChartsOption } from 'echarts'
import { EChartsLinePluginProps } from 'type/line'
import { EChartsPiePluginProps } from 'type/pie'
import { EChartsBarPluginProps } from 'type/bar'
import { EChartsMapPluginProps } from 'type/map'
import { EChartsMapEchartPluginProps } from 'type/map-echart'

export type EChartsStylesProps = {
  height?: number
  width?: number
}

export interface EChartsProps {
  height?: number
  width?: number
  echartOptions: EChartsOption
}

export interface Base {
  name: string
  tags: string[]
  description: string
  exampleGallery: { url: string }[]
}

export type ChartType = string | 'line' | 'pie' | 'bar' | 'map' | 'map-echart'
export type ChartPropsType = unknown | EChartsLinePluginProps | EChartsPiePluginProps | EChartsBarPluginProps | EChartsMapEchartPluginProps

export type ChartItemProps = {
  'line'?: EChartsLinePluginProps
  'pie'?: EChartsPiePluginProps
  'bar'?: EChartsBarPluginProps
  'map'?: EChartsMapPluginProps
  'map-echart'?: EChartsMapEchartPluginProps
  [key: string]: any
}

enum t {
  a = 'a',
  b = 'b'
}

function toString(x: 'line'): EChartsStylesProps
function toString(x: 'pie'): EChartsProps
function toString(x: keyof ChartItemProps): EChartsStylesProps | EChartsProps | undefined {
  if (x === 'line') {
    return {}
  } else if (x === 'pie') {
    return {}
  }
}

const a = toString('line')

export * from 'type/line'
export * from 'type/pie'
export * from 'type/bar'